// Create a module
var myModule = angular.module('timeExampleModule', []);

// Configure the injector
myModule.factory('time', function($timeout) {
    var time = {};

    (function tick() {
        time.now = new Date().toString();
        $timeout(tick, 1000);
    })();
    return time;
});

var myController = myModule.controller('ClockCtrl', function($scope, time){
    $scope.time = time;
    $scope.url = unescape('$injector/modulerr?p0=m&p1=Error%3A%20%5…%2Fwww.mytest.com%2Fstatic%2Fjs%2Fcontroller%2FTimeController.js%3A20%3A25');
});

// create an injector and configure it from 'myModule'
//var $injector = angular.injector('myModule');

//// retrieve an object from the injector by name
//var time = $injector.get('time');
//
//// You write functions such as this one.
//function doSomething(time) {
//    // do something here.
//    console.log(time);
//}
//
/////////////////////////////////////////////////
//// the cool way of getting dependencies.
//// the $injector will supply the arguments to the function automatically
//
//// This is how the framework calls your functions
//$injector.invoke(doSomething);